/**
 * Project: push-center-biz-dal
 * 
 * File Created at 2014年10月9日
 * 
 * Copyright 2012 Greenline.com Corporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Greenline Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Greenline.com.
 */
package com.greenline.push.dal.pushcenter.impl;

import com.greenline.push.dal.base.BaseDAO;
import com.greenline.push.dal.pushcenter.GroupDAO;
import com.greenline.push.dal.pushcenter.dataobject.GroupDO;
import com.greenline.push.dal.query.GroupQuery;

/**
 * @Type GroupDAOImpl
 * @Desc
 * @author zhaoli
 * @date 2014年10月9日
 * @Version V1.0
 */
public class GroupDAOImpl extends BaseDAO implements GroupDAO {

    /*
     * (non-Javadoc)
     * 
     * @see
     * com.greenline.push.dal.pushcenter.GroupDAO#insert(com.greenline.push.
     * dal.pushcenter.dataobject.GroupDO)
     */
    @Override
    public Long insert(GroupDO group) {
        return (Long) super.getSqlMapClientTemplate().insert("group.insert", group);
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * com.greenline.push.dal.pushcenter.GroupDAO#getGroupById(java.lang.Long)
     */
    @Override
    public GroupDO getGroupById(Long id) {
        return (GroupDO) super.getSqlMapClientTemplate().queryForObject("group.find_by_id", id);
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * com.greenline.push.dal.pushcenter.GroupDAO#update(com.greenline.push.
     * dal.pushcenter.dataobject.GroupDO)
     */
    @Override
    public int update(GroupDO group) {
        return super.getSqlMapClientTemplate().update("group.update", group);
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * com.greenline.push.dal.pushcenter.GroupDAO#listByQuery(com.greenline.
     * push.dal.query.GroupQuery)
     */
    @Override
    public GroupQuery listByQuery(GroupQuery query) {
        return (GroupQuery) super.listByQuery("group.list_by_query", query);
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.greenline.push.dal.pushcenter.GroupDAO#delete(java.lang.Long)
     */
    @Override
    public int delete(Long id) {
        return super.getSqlMapClientTemplate().delete("group.delete", id);
    }

    @Override
    public GroupDO getByGName(String name) {
        return (GroupDO) getSqlMapClientTemplate().queryForObject("group.get_group_by_name", name);
    }
}
